﻿using System.Windows.Input;

using TimeSpan.Views.Pages;

namespace TimeSpan.Views.Windows;

public partial class MainWindow {

    public MainWindowViewModel ViewModel { get; }

    public MainWindow(MainWindowViewModel viewModel, INavigationService navigation) {
        ViewModel = viewModel;
        DataContext = this;

        InitializeComponent();

        navigation.SetNavigationFrame(RootFrame);
        navigation.OnNavigated = type => (type switch {
            _ when type == typeof(HomePage) => HomeButton,
            _ when type == typeof(RuntimePage) => HomeButton,
            _ when type == typeof(NotePage) => NoteButton,
            _ when type == typeof(PresetTaskPage) => PresetTaskButton,
            _ when type == typeof(StatisticsPage) => StatisticsButton,
            _ when type == typeof(UserGuidePage) => UserGuideButton,
            _ => throw new NotSupportedException()
        }).IsChecked = true;
    }

    protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) {
        base.OnMouseLeftButtonDown(e);
        DragMove();
    }

}